package net.chenyan.server.repository;/**
 * @author chenyan
 * @createTime 2022/5/13 13:02
 * @description description
 */

import net.chenyan.server.po.UserMusic;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

/**
 *@description: TODO
 *@author: chenyan
 *@create: 2022/5/13 13:02
 */
@Repository
public interface UserMusicRepository extends PagingAndSortingRepository<UserMusic,Integer>, JpaSpecificationExecutor<UserMusic> {
    //分页查询（根据专辑id分页查询所有用户评论的数据）
    @Query(value = "select *  from user_music um where um.music_id=?1 and um.comment is not null",nativeQuery = true)
    Page<UserMusic> findMusicCommentByUserId(int musicId, Pageable pageable);
}
